package com.nidu.demo.mail;

import com.alibaba.cola.dto.MultiResponse;
import com.alibaba.cola.dto.PageResponse;
import com.alibaba.cola.dto.Response;
import com.alibaba.cola.dto.SingleResponse;
import com.nidu.demo.mail.api.SysMailTemplateService;
import com.nidu.demo.mail.dto.*;
import com.nidu.demo.mail.executor.command.*;
import com.nidu.demo.mail.executor.query.*;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.Set;

/**
 * 邮件模板服务实现类
 *
 * @author auto
 */
@Service
@RequiredArgsConstructor
public class SysMailTemplateServiceImpl implements SysMailTemplateService {

    private final MailTemplateAddCmdExe addCmdExe;
    private final MailTemplateUpdateCmdExe updateCmdExe;
    private final MailTemplateDeleteCmdExe deleteCmdExe;
    private final MailTemplateSingleQryExe singleQryExe;
    private final MailTemplateListQryExe listQryExe;
    private final MailTemplatePageQryExe pageQryExe;

    @Override
    public SingleResponse<MailTemplateCO> add(MailTemplateAddCmd cmd) {
        return addCmdExe.execute(cmd);
    }

    @Override
    public SingleResponse<MailTemplateCO> update(MailTemplateUpdateCmd cmd) {
        return updateCmdExe.execute(cmd);
    }

    @Override
    public Response delete(Long id) {
        return deleteCmdExe.execute(id);
    }

    @Override
    public Response delete(Set<Long> ids) {
        return deleteCmdExe.execute(ids);
    }

    @Override
    public SingleResponse<MailTemplateCO> getById(Long id) {
        return singleQryExe.execute(id);
    }

    @Override
    public MultiResponse<MailTemplateCO> list(MailTemplateListQry qry) {
        return listQryExe.execute(qry);
    }

    @Override
    public PageResponse<MailTemplateCO> page(MailTemplatePageQry qry) {
        return pageQryExe.execute(qry);
    }

}
